<?php

/* 
 添加员工
 */
require 'dbcon.php';
$name=$_REQUEST['name'];//获取名字
$imgurl=$_REQUEST['imgurl'];//获取头像
$department=$_REQUEST['department'];//获取部门
$birthday=$_REQUEST['birthday'];//获取生日
$entry=$_REQUEST['entry'];//获取入职时间
$sql="INSERT INTO tb_staff(name,imgurl,department,birthday,entry) VALUES( '{$name}', '{$imgurl}', '{$department}', '{$birthday}', '{$entry}')";
$rs=$db->query($sql);//执行查询语句$sql，生成结果集
$db->close();//关闭数据库连接
if ($rs==true)
{
    echo "<script>";    
    echo "location.href='index.php'";
    echo "</script>";
}
else   
{
    echo "<script>";  
    echo "alert('留言失败！');";
    echo "location.href='index.php'";
    echo "</script>";
}


